package org.linlinjava.litemall.db.service;

import org.linlinjava.litemall.db.dao.LitemallMechanismGoodsSpecificationMapper;
import org.linlinjava.litemall.db.domain.LitemallMechanismGoodsSpecification;
import org.linlinjava.litemall.db.domain.LitemallMechanismGoodsSpecificationExample;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class LitemallMechanismGoodsSpecificationService {
    @Resource
    private LitemallMechanismGoodsSpecificationMapper mechanismGoodsSpecificationMapper;

    public List<LitemallMechanismGoodsSpecification> queryByGid(Integer id) {
        LitemallMechanismGoodsSpecificationExample example = new LitemallMechanismGoodsSpecificationExample();
        example.or().andGoodsIdEqualTo(id).andDeletedEqualTo(false);
        return mechanismGoodsSpecificationMapper.selectByExample(example);
    }

    public void deleteByGid(Integer gid) {
        LitemallMechanismGoodsSpecificationExample example = new LitemallMechanismGoodsSpecificationExample();
        example.or().andGoodsIdEqualTo(gid);
        mechanismGoodsSpecificationMapper.logicalDeleteByExample(example);
    }

    public void add(LitemallMechanismGoodsSpecification goodsSpecification) {
        mechanismGoodsSpecificationMapper.insertSelective(goodsSpecification);
    }
}
